﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 音频管理器
/// </summary>
public class AudioManager : MonoBehaviour
{
    public static AudioManager Instance;

    [Header("背景音乐")]
    public AudioSource BGM_Audio;
    [Header("按钮点击音效")]
    public AudioClip button_Clip;
    [Header("选择音效")]
    public AudioClip choice_Clip;
    [Header("战斗音效")]
    public AudioClip fight_Clip;
    private AudioSource audioSource;


    private void Awake()
    {
        Instance = this;
        audioSource = GetComponent<AudioSource>();
    }

    // 背景音乐控制
    public void BGMController(bool play)
    {
        if (play)
            BGM_Audio.Play();
        else
            BGM_Audio.Pause();
    }

    // 按钮点击音效
    public void PlayButtonSound()
    {
        audioSource.PlayOneShot(button_Clip);
    }

    // 判断选择音效
    public void PlayChoiceSound()
    {
        audioSource.PlayOneShot(choice_Clip);
    }

    // 战斗音效
    public void PlayFightSound()
    {
        audioSource.PlayOneShot(fight_Clip);
    }
}
